<template>
{{#if ctrl.psSysPFPlugin}}
    {{> @macro/plugins/widget/widget-use.hbs appPlugin=ctrl.psSysPFPlugin}}
{{else}}
    <AppMenu
        :class="classNames"
        :menus="store.menus"
        :counterData="props.counterData"
        :selectionName="store.selectionName"
        :menuStyle="props.menuStyle"
        @menuClick="(name) => { handleMenuClick(controller, name) }"
    ></AppMenu>
{{/if}}
</template>
<script setup lang="ts">
{{> @macro/plugins/widget/widget-import.hbs ctrl=ctrl}}
import { AppMenu } from '@components/widgets/menu';
import { model } from './{{spinalCase ctrl.codeName}}-menu-model';
import { useNavParamsBind, getCtrlClassNames, useEventBind, handleMenuClick } from '@/hooks/use-ctrl';
import { AppMenuActionType, AppMenuController, IAppMenuAbility, IAppMenuController, IAppMenuControllerParams, IAppMenuStore, IContext, ILoadingHelper, IParam, IViewCtx } from '@/core';

{{> @macro/widgets/ctrl/ctrl-props.hbs
    props="viewStyle?: string;
    isDefaultPage?: boolean;
    isBlankMode?: boolean;
    defPSAppView?: string;
    menuStyle?:string;
    counterData?: IParam;
    "
    propsDefault="viewStyle: 'DEFAULT',
    isDefaultPage: false,
    isBlankMode: false,
    menuStyle:'DEFAULT'"
}}


{{> @macro/common/emit.hbs name="ctrl" actionType="AppMenuActionType" ability="IAppMenuAbility"}}


const classNames = computed(() => {
    const classNames = getCtrlClassNames(model, props);
    return classNames;
});

const params:IAppMenuControllerParams<AppMenuActionType, IAppMenuAbility> = {
    model,
    evt,
    isDefaultPage: props.isDefaultPage,
    isBlankMode: props.isBlankMode,
    defPSAppView: props.defPSAppView,
    closeView: props.closeView,
    pLoadingHelper: props.pLoadingHelper,
    actions: { },
    menuStyle:props.menuStyle,
    handler: (data: IAppMenuStore) => { return reactive(data) }
};

{{> @macro/common/controller.hbs name="ctrl" IController="IAppMenuController" store="IAppMenuStore" ability="IAppMenuAbility" controller="AppMenuController"}}

</script>